package ch.mueller.android.nmeaexample.util.readerFactoryElements;

import java.util.LinkedHashMap;

public class GSAAnalyser extends GPSLineAnalyser {

    public GSAAnalyser(String line) {
        super(line);
    }

    @Override
    public LinkedHashMap<String, String> getResult() {
        LinkedHashMap<String, String> element = new LinkedHashMap<String, String>();
        int i = 0;
        String[] splitts = line.split(",");
        element.put("TYPE", getValue(splitts, i++));
        element.put("Mode 1", getValue(splitts, i++));
        element.put("Mode2", getValue(splitts, i++));
        element.put("SateliteUsed1", getValue(splitts, i++));
        element.put("SateliteUsed2", getValue(splitts, i++));
        element.put("SateliteUsed3", getValue(splitts, i++));
        element.put("SateliteUsed4", getValue(splitts, i++));
        element.put("SateliteUsed5", getValue(splitts, i++));
        element.put("SateliteUsed6", getValue(splitts, i++));
        element.put("SateliteUsed7", getValue(splitts, i++));
        element.put("SateliteUsed8", getValue(splitts, i++));
        element.put("SateliteUsed9", getValue(splitts, i++));
        element.put("SateliteUsed10", getValue(splitts, i++));
        element.put("SateliteUsed11", getValue(splitts, i++));
        element.put("SateliteUsed12", getValue(splitts, i++));
        element.put("PDOP", getValue(splitts, i++));
        element.put("HDOP", getValue(splitts, i++));
        element.put("VDOP", line.substring(line.length() - 5, line.length() - 3));
        element.put(CHECKSUM, calculateCheksum(line));
        return element;
    }
}
